package com.pengcheng.taskapplication.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.pengcheng.taskapplication.R;
import com.pengcheng.taskapplication.model.BankVo;
import com.pengcheng.taskapplication.model.TaskVo;
import com.pengcheng.taskapplication.model.WalletModel;
import com.pengcheng.taskapplication.mvp.view.widget.CircleImageView;

import java.util.List;

public class BankAdapter extends BaseAdapter {

	Context context;
	LayoutInflater inflater;
	List<WalletModel> bankVos;
	int last_item;
	private int selectedPosition = -1;
	public BankAdapter(Context context, List<WalletModel> bankVos){
		this.context = context;
		this.bankVos = bankVos;
		inflater= LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return bankVos.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return bankVos.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder  holder = null;
		if(convertView==null){
			convertView = inflater.inflate(R.layout.activity_bank_list_item_layout, null);
			holder = new ViewHolder();
			holder.tv_bank_num=(TextView) convertView.findViewById(R.id.tv_bank_num);
			convertView.setTag(holder);
		}
		else{
			holder=(ViewHolder)convertView.getTag();
		}

		WalletModel model= bankVos.get(position);
		holder.tv_bank_num.setText(model.getBankCardCode());
		return convertView;
	}

	public static class ViewHolder{
		public TextView tv_bank_num;
		public CircleImageView circleImage;

	}

	public void setSelectedPosition(int position) {
		selectedPosition = position;
	}

}
